package pe.com.hermes.hermetic.negocio.ultil;

import org.apache.log4j.Logger;

public class CadenaUtil {
    
    static Logger logger = Logger.getLogger("");
    public CadenaUtil() {
    }
    
    public static void logSQL(Class ClaseDao, String metodo, String sql){
    
        StringBuffer sb = new StringBuffer();                
        sb.append("LOG SQL - CLASE : ")
        .append(ClaseDao)
        .append(" METODO: ")
        .append(metodo)
        .append(" SQL: ")
        .append(sql);
        
        logger.info(sb.toString());
    }
    
    public static String completaEspaciosBlanco(String cadena, String caracter, 
                                           String posicion, int longitud) {
        String new_cadena = cadena;
        while (longitud > new_cadena.length()) {
            if (posicion.equals("L"))
                new_cadena = caracter + new_cadena;
            else if (posicion.equals("R"))
                new_cadena = new_cadena + caracter;
            else
                new_cadena = caracter + new_cadena;
        }
        /*
        StringBuffer newCadena = new StringBuffer(cadena);
        while (longitud > newCadena.length()) {
            if (posicion.equals("L"))
                //new_cadena = caracter + new_cadena;
                newCadena.append(caracter).append(newCadena);
            else if (posicion.equals("R"))
                //new_cadena = new_cadena + caracter;
                newCadena.append(caracter).append(newCadena);
            else
                //new_cadena = caracter + new_cadena;
                newCadena.append(caracter).append(newCadena);
        }*/
        return new_cadena;
    }
    
    
}
